define(['app'], function (app) {
    app.controller('pwdmod', function ($http) {
        layui.use(['element', 'form'], function () {
            var element = layui.element;
            var form = layui.form;
            form.render();
            //监听提交
            form.on('submit(formDemo)', function (data) {


                $http({
                    method: 'POST',
                    url: '/OSRS/user/password',
                    data:JSON.stringify(data.field)
                }).then(function (res) {
                    console.log(res.data);
                    if (res.data == "ok") {
                        layer.msg("修改成功");
                    }else if (res.data == "false") {
                        layer.msg("修改失败");
                    }else if (res.data == "new") {
                        layer.msg("密码不一致");
                    }
                    layer.close(oldUserForm);
                }, function (err) {
                    layer.msg("服务器未响应");
                });

                return false;
            });
        });

    });
}); 
